<template>
 <div class="container">
    <div>Header</div>
    <h2>{{num}}</h2>
    <h2>{{nuame}}</h2>
    <button @click="handleAdd(1)">累加num</button>
 </div>
</template>
<script>
export default {
  name: "Header",
  data() {
    return {};
  },
  methods: {
    handleAdd(count){
        this.$store.dispatch('add', count)
    }
  },
  computed:{
    ...mapState(["num","uname"])
  },
  created() {}
};
